<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>会员管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet"    href="../themes/base/jquery.ui.all.css" />
	<link rel="stylesheet"      href="css/ui.jqgrid.css" type="text/css" />
	<script type="text/javascript"    src="../jquery-1.7.2.min.js"></script>
	<script type="text/javascript"    src="../ui/jquery-ui.js"></script>
	<script type="text/javascript"     src="src/grid.loader.js"></script>
	<script type="text/javascript"     src="src/i18n/grid.locale-cn.js"></script>
	<script type="text/javascript"      src="js/jquery.jqGrid.min.js"></script>
	
  </head>
  <body>
  <table id="list1"></table>
<div id="pager1"></div>
<div id="pager2"></div>
<input type="BUTTON" id="bedata" value="Edit Selected" />
	<script type="text/javascript"> 
	var lastSel;
				$(function (){
$//("#list1").tableDnD({scrollAmount:0});
$("#list1").jqGrid({
   	url:'http://localhost/newOrder/userHandle/queryUser.jsp',
	datatype: "xml",
   	colNames:['用户ID','用户名称','业务员ID', '最后拜访时间', '地址','手机号码',' '],
   	colModel:[
		{name:'act',index:'act', editable:true, width:75,sortable:false},
   		{name:'id',index:'id', width:75},
   		{name:'invdate',index:'invdate', width:90,editable:true},
   		{name:'name',index:'name', width:100},
   		{name:'amount',index:'amount', width:80, align:"right"},
   		{name:'tax',index:'tax', width:80, align:"right",editable:true},		
		{name:'myac', width:80, fixed:true, sortable:false, resize:false, formatter:'actions',
			formatoptions:{keys:false}}
   	],
	//scroll: true,
   	rowNum:5,
   	autowidth: true,
   	rowList:[10,20,30],
	prmNames:{page:'page',rows:'rows',order: 'sord', search:'_search', nd:'nd', npage:null},
	//postData:{page:'page',rows:'rows', sort: 'sidx',order: 'sordsdf'},
   	pager: jQuery('#pager1'),
   	sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    caption:"XML Example",	
	forceFit : true,
	cellEdit: true,
	cellsubmit: 'clientArray',
	afterEditCell: function (id,name,val,iRow,iCol){
		if(name=='tax'||name=="invdate") {
			jQuery("#"+iRow+"_"+name,"#list1").datepicker({dateFormat:"yy-mm-dd"});
			
		}
	},
	afterSaveCell : function(rowid,name,val,iRow,iCol) {
	
	},
	loadCompele:function(){alert("compele")},
	loadError:function(){alert("error")},
	onSelectRow: function(id){    
      if(id && id!==lastSel){    
        // jQuery('#list1').restoreRow(lastSel);    
        // lastSel=id;    
      }  
	  //alert(id);  
      //jQuery('#list1').editRow(id, true);    
   },   
	editurl:"http://localhost/newOrder/userHandle/queryUser.jsp"
}).navGrid('#pager1',{edit:true,add:true,del:true}).navButtonAdd('#pager1',{   
   caption:"添加",    
   buttonicon:"ui-icon-add",    
   onClickButton: function(){    
     alert("Adding Row");   
   },    
	gridComplete: function() {
    	$("#_empty","#list1").addClass("nodrag nodrop");
    	jQuery("#list1").tableDnDUpdate();
    }, 
});	
});
$("#bedata").click(function(){
	$("#list1").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false})});
</script> 

</body>
</html>

